%% Getting the parser booted up while setting up some basics

true.

':-'(op(1200,fx,':-')).

:- op(700,xfx,'=').
X = X.

:- op(1200,xfx,':-').
call(X) :- X.

:- op(1000,xfy,',').
(X,Y) :- X, Y.

:- op(1100,xfy,';').
:- op(1050,xfy,'->').
( P -> X )     :- P,!,X.
( P -> X ; Y ) :- !, ((P, !, X) ; Y).
(X;Y) :- X.
(X;Y) :- Y.

:- op(900,fy,'\+').
\+ X :- call(X), !, fail.
\+ X.

:- op(700,xfx,'\=').
X \= Y :- \+ X = Y.

:- op(1025,xfx,'=>').
This => That :- \+ (call(This), \+ call(That)).

:- op(700,xfx,'==').
V1 == V2 :-
  var(V1), var(V2),
  \+ (V1 = chalk, V2 = cheese).
C1 == C2 :-
  functor(C1, C, N), functor(C2, C, N),
  ( arg(I,C1,A1),arg(I,C2,A2) => A1 == A2 ).

:- op(400,yfx,'/').
:- multifile(term_expansion/2).

expand_term(Term,Expansion) :- term_expansion(Term,Expansion) -> true ; Term = Expansion.

:- op(700,xfx,'=..').
%% Primitive

repeat.
repeat :- repeat.

consult(Filename) :- parse_file(Filename,Parse), maplist(assert,Parse).

:- op(700,xfx,'-').
:- op(700,xfx,'>=').
:- op(700,xfx,'=<').

